package com.sq.partner.manager.dao.impl;

import java.sql.SQLException;

import org.springframework.stereotype.Repository;

import com.sq.partner.manager.dao.FacadeTempPolicyDao;
import com.sq.partner.manager.mybatis.model.FacadeTempPolicy;

/**
 * 暂存单Dao
 * @author zhouxiuxiu
 *
 */
@Repository
public class FacadeTempPolicyDaoImpl extends BaseDaoImpl implements
        FacadeTempPolicyDao {

    /**
     * 生成一个暂存单号
     */
    @Override
    public String queryNewStagNo() throws SQLException {
        return (String) query("queryNewStagNo", "ZC");
    }

    /**
     * 增加暂存单信息
     */
    @Override
    public void insertFacadeTempPolicy(FacadeTempPolicy facadeTempPolicy)
            throws Exception {
        this.add("insertFacadeTempPolicy", facadeTempPolicy);
    }

    /**
     * 修改暂存单信息
     * @param facadeTempPolicy
     * @throws Exception
     */
    @Override
    public void updateTempPolicyNotNull(FacadeTempPolicy facadeTempPolicy)
            throws Exception {
        this.update("updateFacadeTempPolicyNotNull", facadeTempPolicy);
    }
    
    @Override
    public FacadeTempPolicy selectFacadeTempPolicy(
          FacadeTempPolicy facadeTempPolicy) throws Exception {
        return (FacadeTempPolicy) this.query("queryFacadeTempPolicyByMap2",
              facadeTempPolicy);
    }
    
    /**
     * 根据ID查询暂存单
     * 
     * @param stageNo
     * @return
     * @throws Exception
     */
    @Override
    public FacadeTempPolicy queryFacadeTempPolicyById(String stageNo)
         throws Exception {
       return (FacadeTempPolicy) this.query("queryFacadeTempPolicyById",
             stageNo);
    }
    
    /**
     * 根据投保单号查询暂存单信息（新意健险）
     * 
     * @param appNo
     *            投保单号
     **/
    @Override
    public FacadeTempPolicy getTempPolicyByAppNo(String appNo) throws Exception {
        return (FacadeTempPolicy) this.query("getTempPolicyByAppNo", appNo);
    }
    
    
	/**
	 * 支付完成更新暂存单表状态为12 支付完成 20190425 helina
	 * @param facadeTempPolicy
	 * @return
	 * @throws Exception
	 */
    @Override
	public boolean updateFacadeTempPolicyStatus12(FacadeTempPolicy facadeTempPolicy) throws Exception{
		return this.update("updatePolicyStatus12", facadeTempPolicy);
	}
}
